const MongoClient =require('mongodb').MongoClient

const client =new MongoClient('mongodb://localhost/demo')
client.connect(function(error){
    if(error) throw error

    const db=client.db()
    const col=db.collection('peo')
    col.insertMany(
        [
            {name:'s1234',passwd:'123466',sex:'男',birth:'19990302',address:'zhejiang'},
            {name:'5667',passwd:'123466',sex:'女',birth:'19990602',address:'zhejiang'},
            {name:'5667',passwd:'123466',sex:'女',birth:'19990602',address:'zhejiang'},
            {name:'098',passwd:'123466',sex:'女',birth:'19990126',address:'zhejiang'},
            {name:'s465',passwd:'123466',sex:'男',birth:'19990502',address:'zhejiang'}
        ],
        function(error,result){
            if(error) throw error
            console.log(result)
            client.close()
        }
    )
    col.find().toArray(
        function(error,result){
            if(error) throw error
            console.log(result)
            client.close()
        }
    )
})
